﻿#pragma once
#include "AsGraphicsObject.h"

namespace AsGraphicsNamespace {

	class AsGraphicsScaleplatePrivate;

	class AS_GRAPHICS_API AsGraphicsScaleplate : public AsGraphicsObject, AsBinder<AsGraphicsScaleplate> {
		Q_OBJECT

	public:
		explicit AsGraphicsScaleplate(QObject* parent = nullptr);
		explicit AsGraphicsScaleplate(AsGraphics* graphics, QObject* parent = nullptr);
		~AsGraphicsScaleplate();
		enum Direction { HorizontalTop, HorizontalBottom, VerticalLeft, VerticalRight };

	private:
		AsGraphicsScaleplatePrivate* mp;

	public:
		void create(AsGraphics* graphics, QObject* parent = nullptr);
		void destroy();

	public:
		void update();

	public:
		void setPosition(int x, int y);
		void setPosition(const QPointF& position);
		void setDimension(int length, int width);
		void setDimension(int length, int width, Direction direction);
		void setDirection(Direction direction);
		void setPositionDimension(int x, int y, int length, int width, Direction direction);
		void setSegmentBeginOffset(double beginOffset);
		void setSegmentInterval(double interval);
		void setSegmentSmallCount(int smallSegmentCount);
		void setSegmentBigLineRatio(float bigSegmentLineRatio);
		void setSegmentSmallLineRatio(float smallSegmentLineRatio);
		void setSegment(double beginOffset, double interval, int smallSegmentCount, float bigSegmentLineRatio, float smallSegmentLineRatio);
		void setValueBegin(float beginValue);
		void setValueInterval(float intervalValue);
		void setValue(float beginValue, float intervalValue);
		void setValueDecimals(int number);
		void setValueFormat(QString format = "%1");
		void setEnable_showTwoEndSide(bool isEnable = true);
		void setEnable_showNonScaleSide(bool isEnable = true);
		void setEnable_autoFillWidget(bool isEnable = true);
		void setEnable_autoAlignCoordSystem(bool isEnable = false, AsGraphics* targetGraphics = nullptr, double conversionRatio = 1.0);

	public:
		void setColor_outsideRect(const QColor& borderColor, const QColor& fillColor = Qt::white);
		void setColor_bigSegmentLine(const QColor& color);
		void setColor_smallSegmentLine(const QColor& color);
		void setColor_numberText(const QColor& color);
		void setFont_numberText(const QFont& font);

	};

	typedef AsGraphicsScaleplate Scaleplate;

};

